﻿@model ShopBarModel
@using SmartStore.Web.Models.Common;

<div id="shopbar" class="clearfix">

    <div class="container">
       
        @if (Model.ShoppingCartEnabled)
        {
            <!-- CART -->
            <div class="shopbar-tool pull-left" id="shopbar-cart">
                <a class="shopbar-button clearfix" data-target="shopbar-flyout-cart" href="@Url.RouteUrl("ShoppingCart")" data-summary-href='@Url.Action("ShoppingCartSummary", "ShoppingCart")'>
                    <figure class="shopbar-button-icon pull-left">
                        <i data-icon="8" class="sm-icon-x"></i>
                        <span class='label @(GetThemeVariable<string>("ShopBarLabel")) @(Model.ShoppingCartItems == 0 ? "hide" : "")' data-bind-to="TotalProducts">@Model.ShoppingCartItems</span>
                    </figure>
                    <span class="shopbar-button-label pull-left">
                        <span>@T("ShoppingCart.Totals.SubTotal"): <span data-bind-to="SubTotal">@Model.ShoppingCartAmount</span></span><br />
                        <span style="font-weight: bold">@T("Common.Shopbar.Basket") <i class="icon-caret-down"></i></span>
                    </span>
                    <span class="sm-arrow"></span>
                </a>                
                <div class="shopbar-flyout" id="shopbar-flyout-cart" data-href='@Url.Action("FlyoutShoppingCart", "ShoppingCart")'>
                    @*@Html.Action("FlyoutShoppingCart", "ShoppingCart")*@
                </div>
            </div>
        }

        @{
            string accountUrl = Model.IsAuthenticated ? Url.RouteUrl("CustomerInfo") : Url.RouteUrl("Login");
        }

        <!-- ACCOUNT -->
        <div class="shopbar-tool pull-right loaded" id="shopbar-account">
            <a class='shopbar-button clearfix@(!Model.IsAuthenticated ? " no-drop" : "")' data-target="shopbar-flyout-account" href="@accountUrl">
                <figure class="shopbar-button-icon pull-left">
                    <i class="sm-icon-user-5"></i>
                </figure>
                <span class="shopbar-button-label pull-left">
                    @if (Model.IsAuthenticated)
                    {
                        <span>@Model.CustomerEmailUsername</span><br />
                        <span style="font-weight: bold">
                            @T("Account.MyAccount")
                            <i class="icon-caret-down"></i>
                        </span>
                    }
                    else
                    {
                        <span>@T("Common.Shopbar.GuestGreeting")</span><br />
                        <span style="font-weight: bold">@T("Account.Login")</span>
                    }
                </span>
                <span class="sm-arrow"></span>
            </a>
            @if (Model.IsAuthenticated) 
            {
                @Html.Action("AccountDropdown", "Common")
            }
        </div>

        <!-- WISHLIST -->
        @if (Model.WishlistEnabled)
        {
            <div class="shopbar-divider"></div>
            
            <div class="shopbar-tool pull-right" id="shopbar-wishlist">
                <a class="shopbar-button clearfix" data-target="shopbar-flyout-wishlist" href="@Url.RouteUrl("Wishlist")" data-summary-href='@Url.Action("ShoppingCartSummary", "ShoppingCart", new { isWishlist = true })'>
                    <figure class="shopbar-button-icon pull-left">
                        <i class="sm-icon-gift-2"></i>
                        <span class='label @(GetThemeVariable<string>("ShopBarLabel")) @(Model.WishlistItems == 0 ? "hide" : "")' data-bind-to="TotalProducts">@Model.WishlistItems</span>
                    </figure>
                    <span class="shopbar-button-label pull-left">
                        <span>@T("Common.Shopbar.WishlistPartOne")</span><br />
                        <span style="font-weight: bold">@T("Common.Shopbar.WishlistPartTwo") <i class="icon-caret-down"></i></span>
                    </span>
                    <span class="sm-arrow"></span>
                </a>                
                <div class="shopbar-flyout" id="shopbar-flyout-wishlist" data-href='@Url.Action("FlyoutWishlist", "ShoppingCart")'>
                    @*@Html.Action("WishlistDropdown", "ShoppingCart")*@
                </div>
            </div>
        } 

        <!-- COMPARE -->
        @if (Model.CompareProductsEnabled)
        {
            <div class="shopbar-divider"></div>
            
            <div class="shopbar-tool pull-right" id="shopbar-compare">
                <a class="shopbar-button clearfix" data-target="shopbar-flyout-compare" href="@Url.Action("CompareProducts", "Catalog")" data-summary-href='@Url.Action("CompareSummary", "Catalog")'>
                    <figure class="shopbar-button-icon pull-left">
                        <i class="sm-icon-loop-alt2"></i>
                        <span class='label @(GetThemeVariable<string>("ShopBarLabel")) @(Model.CompareItems == 0 ? "hide" : "")' data-bind-to="Count">@Model.CompareItems</span>
                    </figure>
                    <span class="shopbar-button-label pull-left">
                        <span>@T("Common.Shopbar.CompareProductsPartOne")</span><br />
                        <span style="font-weight: bold">@T("Common.Shopbar.CompareProductsPartTwo") <i class="icon-caret-down"></i></span>
                    </span>
                    <span class="sm-arrow"></span>
                </a>
                <div class="shopbar-flyout" id="shopbar-flyout-compare" data-href='@Url.Action("FlyoutCompare", "Catalog")'>
                    @*@Html.Action("CompareDropdown", "Catalog")*@
                </div>
            </div>
        }

        <!-- SEARCH -->
        @Html.Action("SearchBox", "Catalog")

    </div>
</div> 